home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
UTIL
/
SCREEN
/
WPAPER
/
Help
< prev
next >
Wrap
Text File
|
1993-09-13
|
5KB
|
178 lines
Introduction
~~~~~~~~~~~~
WallPaper is a utility that allows you to have a randomly
selected sprite as your backdrop. The backdrop can also
be updated at regular intervals if you wish. It only works
under RISC OS 3, and is only useful on a hard disc machine.
**********************************************************
Before you Start
~~~~~~~~~~~~~~~
Before WallPaper is run, two system variables must be
defined:
1) BackDrop$Path is the path on which the sprites to use are
found. Thus if you have a collection of sprites in, say, the
directory
adfs::HD4.$.Resources.Backdrops
You should issue the command
Set Backdrop$Path adfs::HD4.$.Resources.Backdrops.
Note carefully the final '.' on this line.
(Shift-Drag of a file into a text editor generally inserts
the full file specification at the cursor, which may be
useful)
2) Wallpaper actually uses the command 'BDrop' to load
a backdrop. This does nothing! Seriously, you should create
an alias for BDrop that load your backdrops in the way you
want. A suitable command is
SetMacro Alias$BDrop Backdrop -C Backdrop:<BackDrop$Current>
You can alter the -C to -S or -T if you want your sprites
scaled or tiled instead of centred. This must be a macro.
**********************************************************
Usage
~~~~~
Now you can run WallPaper. This does nothing immediately.
You will find now, however, that
Set BackDrop$Interval n
will cause a fresh, randomly selected, sprite to be loaded
every <n> seconds. Do not make <n> too small! I would say
that 20 seconds is about the most frequently that any sane
person could stand a change of backdrop.
An important exception is an <n> of zero (and any non-number
will evaluate as zero)
Set BackDrop$Interval 0
which will load a backdrop immediately, but does not repeat.
**********************************************************
In !Boot Files
~~~~~~~~~~~~~~
The best way to use WallPaper is in a !Boot
file/application.
(Part of) my !Boot application does:-
Set BackDrop$Path Boot:!Backdrops.Backdrops.
SetMacro Alias$BDrop Backdrop -C Backdrop:<Backdrop$Current>
WallPaper
Set BackDrop$Interval 0
Set BackDrop$Interval 60
Notice the Set 0 .. Set 60 This gives me a backdrop
immediately and then changes it every sixty seconds.
**********************************************************
Extensions
~~~~~~~~~~
The advantage of using the 'BDrop' alias and having
'BackDrop$Path' is that you can set up application folders
containing backdrop sprites, and with !Run files similar
to
Set Backdrop$Path <Obey$Dir>.
Set BDrop -<whichever> Backdrop:<Backdrop$Current>
Set Backdrop$Interval <n>
so you can have lots of backdrops, centre-able "?" ones in
one directory, scaleable in another, tile-able in a third.
You should ideally set Backdrop$Interval whenever the
number of files in the directory changes to ensure that
the code notices the new files (or missing ones).
Deleting sprites from the current backdrop directory is ok.
Adding them is also ok, but you should then do a set
Backdrop$Interval so that the changes are noticed.
**********************************************************
Technical Details
~~~~~~~~~~~~~~~~~
If you've got this far, you'll have guessed by now that
WallPaper is implemented as a code variable.
Running WallPaper sets up BackDrop$Interval as a code
variable.
Reading BackDrop$Interval returns an integer value.
Writing to it with a non-zero value, call this V, (as
evaluated by OS_ReadUnsigned) causes, more-or-less, the
following:
i) Immediately, the number of files in the first directory
on the path Backdrop: is evaluated. Call this N.
ii) After at least V seconds code is executed which
selects a random integer in the range 1..N. The name
of the 0th..(N-1)th file in the backdrop directory is
resolved, checked for beiing of sprite file type and
stored it in another variable Backdrop$Current.
iii) Finally the command 'BDrop' is issued (which can
be aliased to anything at all, but is intended to
be 'BackDrop Backdrop:<Backdrop$Current>'.
Note that the only way of removing a code variable
is to use OS_SetVarVal with the right parameters. It's
considered a very good idea to do a
Set BackDrop$Interval 0
to make it quiescent first, however. Calling non-existent
code from an interrupt is harmful to your machine's health.
Errors:
If WallPaper spots anything wrong it calls OS_GenerateError
which will generally produce a useful error message.
Loading the backdrop may also produce error messages, a
quite frequent one (on my machine) is 'insufficent memory
to load backdrop sprite'. Serves me right.
One thing that WallPaper does handle internally is trying
to load non-sprite files. If the 'new' file isn't a sprite
it leaves BackDrop$Current unaltered - i.e. the previous
backdrop will be reloaded. A waste of time. So, while
one or two non-sprite files in a 'backdrops' directory,
e.g. subdirectories, are harmless enough, you should avoid
pointing BackDrop$Path at directories that contain the
inverse mix - a few sprites and lots of other files.
I have chosen not to distribute source code to save
bandwidth. If anyone wants it mail me as
aoliver@acorn.co.uk
Ashley Oliver
Sep 10th, 1993
**********************************************************